package com.example;

import com.example.printerfile.Printer;
import com.example.rabbitmq.ReceiveServerMessage;
import com.example.user.UserHandler;

import java.util.Iterator;
import java.util.List;

/**
 * 主程序入口
 */
public class Main {
    public static void main(String[] args)throws Exception {
//        String queueName  = "ba7755d1-f0c1-4cfa-8553-749671a6c151";
//        //拉起rabbitmq 接收消息 启动消息监听机制
//        ReceiveServerMessage.receiveMessageExchange(queueName);
        //启动测试
        System.out.println("系统初始化完毕,启动登录服务!");
        String shopId = UserHandler.login(Configuration.LOGIN_USER_NAME,Configuration.LOGIN_PASSWORD);
        if(shopId == null){
            System.out.println("登录失败！退出程序！");
            System.exit(0);
        }
        System.out.println("开始扫描系统打印机！");
        List<String> list = Printer.getPrinterList();
        Iterator iterator = list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("打印机扫描完毕!开始处理订单！");
        ReceiveServerMessage.receiveMessageExchange(shopId);

    }
}
